using System.Collections;

namespace com.exceptionalsoftware.spacetime.KML
{
	public class SimpleGenericList<T>
	{
		private ArrayList objectList;

        public SimpleGenericList()
		{
            this.objectList = new ArrayList();
		}

        public SimpleGenericList(T[] items) : this()
        {
            if (items != null)
            {
                this.objectList.AddRange(items);
            }
        }

        public int Count
        {
            get { return this.objectList.Count; }
        }

        public T this[int index]
        {
            get { return (T)this.objectList[index]; }
        }

        public void Clear()
        {
            this.objectList.Clear();
        }

        public void Add(T item)
        {
            if (item != null)
            {
                this.objectList.Add(item);
            }
        }

        public void Remove(T item)
        {
            if (item != null)
            {
                this.objectList.Remove(item);
            }
        }

        public T[] ToArray()
        {
            return (T[])this.objectList.ToArray(typeof(T));
        }
    }
}